package com.tool.tools.view;

import com.tool.tools.view.pages.TimeStampPage;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.springframework.context.ConfigurableApplicationContext;

public class CustomApp extends Application {

    private static Scene mainScene; // 静态变量保存主场景

    @Override
    public void start(Stage primaryStage) {
        // 创建主页面
        VBox mainLayout = new VBox(10);
        mainLayout.setPadding(new Insets(10));

        Button timestampConverterButton = new Button("时间戳转换");
        timestampConverterButton.setOnAction(e -> TimeStampPage.showTimestampConverter(primaryStage, mainScene));

        mainLayout.getChildren().add(timestampConverterButton);
        mainScene = new Scene(mainLayout, 600, 300); // 初始化主场景
        primaryStage.setTitle("自定义工具");
        String externalForm = this.getClass().getResource("/static/tools-hardware.png").toExternalForm();
        primaryStage.getIcons().add(new Image(externalForm));
        primaryStage.setScene(mainScene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
